#pragma once

#include "cpu.h"
#include "MpBootInfo.h"

#define PLATFORM_DEBUGGER_1394           0x2 
#define PLATFORM_DEBUGGER_NONE           0x0 
#define PLATFORM_DEBUGGER_SERIAL         0x1 
#define PLATFORM_ERROR_BAD_PLATFORM      0x2
#define PLATFORM_ERROR_BAD_SIZE          0x1 
#define PLATFORM_EXIT_AND_HALT           0x1ffc 
#define PLATFORM_EXIT_AND_RESTART        0x1fff 
#define PLATFORM_EXIT_AND_SHUTDOWN       0x1ffe 
#define PLATFORM_EXIT_AND_WARMBOOT       0x1ffd 
#define PLATFORM_IO_MEMORY_SIZE          0x800000 
#define PLATFORM_KERNEL_BOUNDARY         0x40000000 
#define PLATFORM_MAX_VIRTUAL_ADDR        0x80000000 
#define PLATFORM_MP_ABI_BASE             0x600000 
#define PLATFORM_PAGE_SIZE               0x1000 
#define PLATFORM_SUCCESS                 0x0 
#define PLATFORM_UNCACHED_MAPPED         0x2000000 
#define PLATFORM_UNCACHED_PHYSICAL       0xfe000000

typedef class Platform
{
  public:
    INT32 Size; 
    UINT32 BootYear; 
    UINT32 BootMonth; 
    UINT32 BootDay; 
    UINT32 BootHour; 
    UINT32 BootMinute; 
    UINT32 BootSecond; 
    INT32 CpuMaxCount; // 32
    INT32 CpuRealCount; // 36
    INT32 BootCount; // 40
    ULONG_PTR Smap32; // 44
    INT32 SmapCount; // 48
    ULONG_PTR PhysicalBase; // 52
    LONG_PTR OutgoingMessage; // 56
    LONG_PTR OutgoingCount; // 60
    LONG_PTR IncomingFree; // 64
    LONG_PTR IncomingFreeCount; // 68
    LONG_PTR IncomingMessage; // 72
    LONG_PTR IncomingCount; // 76
    LONG_PTR OutgoingFree; // 80
    LONG_PTR OutgoingFreeCount; // 84
    UINT32 MaxBufferLength; // 88
    UINT32 thisDestinationId; // 92
    UINT32 hasApic; // 96
    ULONG_PTR BootAllocatedMemory; // 100
    ULONG_PTR BootAllocatedMemorySize; // 104
    ULONG_PTR CommandLine32; // 108
    INT32 CommandLineCount; // 112
    INT32 CpuRecordPointerOffset; // 116
    INT32 ThreadRecordPointerOffset; // 120
    ULONG_PTR LogRecordBuffer; // 124
    ULONG_PTR LogRecordSize; // 128
    ULONG_PTR LogTextBuffer; // 132
    ULONG_PTR LogTextSize; // 136
    ULONG_PTR KernelDllBase; // 140
    ULONG_PTR KernelDllSize; // 144
    ULONG_PTR KernelDllFirstPage; // 148
    ULONG_PTR MiniDumpBase; // 152
    ULONG_PTR MiniDumpLimit; // 156
    INT32 DebuggerType; // 160
    PCPU bootCpu;
    UINT32 RecSize; // 168
    UINT16 DebugBasePort; // 172
    UINT16 DebugSpinBase; // 174
    UINT32 TwiddleSpinBase; // 176
    UINT64 Info32; // 180
    UINT64 Kill32; // 188
    UINT32 KillAction; // 196
    UINT64 DumpAddr32; // 200
    UINT64 FileImageTableBase32; 
    UINT32 FileImageTableEntries; 
    UINT32 DumpSize32; 
    UINT64 DumpRemainder; 
    UINT64 DumpLimit; 
    UINT64 NativeContext; 
    UINT64 Cpus; 
    UINT16 BiosPicMask; 
    UINT8 BiosWarmResetCmos; 
    __declspec(align(4))
    UINT32 BiosWarmResetVector; 
    UINT32 Info16; 
    UINT64 IdtEnter0; 
    UINT64 IdtEnter1; 
    UINT64 IdtEnterN; 
    UINT64 IdtTarget; 
    UINT64 Pdpt32; 
    UINT64 KernelPdpt64; 
    UINT64 Undump; 
    UINT32 PciBiosAX; 
    UINT32 PciBiosBX; 
    UINT32 PciBiosCX; 
    UINT32 PciBiosEDX; 
    UINT64 AcpiRoot32; 
    UINT64 PnpNodesAddr32; 
    UINT32 PnpNodesSize32; 
    UINT64 SmbiosRoot32; 
    UINT64 DmiRoot32; 
    UINT32 IsaCsns; 
    UINT16 IsaReadPort; 
    INT8 __padding001[2]; 
    UINT32 Ebda32; 
    UINT32 MpFloat32; 
    UINT64 Ohci1394Base; 
    UINT64 Ohci1394BufferAddr32; 
    UINT32 Ohci1394BufferSize32; 
    UINT64 VesaBuffer;
    UINT64 MpEnter32; 
    UINT32 MpCpuCount; 
    UINT32 MpStatus32; 
    UINT64 MpStartupLock32; 
    MP_BOOT_INFO MpBootInfo; 
    PCPU processors; 
    LONG_PTR /* Class_Microsoft_Singularity_Hal_HalDevices* */ devices;   
} PLATFORM, *PPLATFORM;
